﻿using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Media;

namespace Fighter.Screens
{
    /// <summary>
    /// The options screen is brought up over the top of the main menu
    /// screen, and gives the user a chance to configure the game
    /// in various hopefully useful ways.
    /// </summary>
    class BackToMainMenuScreen : MenuScreen
    {
        #region Fields

        GraphicsDeviceManager graphics;
        Game game;

        #endregion

        #region Initialization

        /// <summary>
        /// Constructor.
        /// </summary>
        public BackToMainMenuScreen(Game game, GraphicsDeviceManager graphics)
            : base("Quitter le jeu et revenir au menu?")
        {
            this.game = game;
            this.graphics = graphics;
            MenuEntry yes = new MenuEntry("Oui");
            MenuEntry no = new MenuEntry("Non");

            // Hook up menu event handlers.
            yes.Selected += YesMenuEntrySelected;
            no.Selected += OnCancel;

            // Add entries to the menu.
            MenuEntries.Add(yes);
            MenuEntries.Add(no);
        }

        #endregion

        #region Handle Input


        /// <summary>
        /// Event handler for when the Yes menu entry is selected.
        /// </summary>
        void YesMenuEntrySelected(object sender, PlayerIndexEventArgs e)
        {
            LoadingScreen.Load(ScreenManager, false, null, new BackgroundScreen(),
                                                           new MainMenuScreen(this.game, this.graphics));
        }


        #endregion
    }
}
